<template>
	<view>
		 <view style="width: 100%;height: 120px;" ref="chartContainer" class="chart-container"></view>
	</view>
</template>

<script>
	import * as echarts from 'echarts'  // 引入ECharts库
	export default {
		name:"ectb",
		data() {
		    return {
		      chart: null,
		    };
		  },
		  onLoad() {
		    this.initChart();
		  },
		  methods: {
		    initChart() {
					const chartContainer = this.$refs.chartContainer
		            this.chart = echarts.init(chartContainer)
		            const option = {
		              title: {
		                text: '折线图示例'
		              },
		              xAxis: {
		                type: 'category', // x轴类型为类目轴
		                boundaryGap: false, // 取消x轴两端空白
		                data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] // x轴类目数据
		              },
		             yAxis: {
		                type: 'value' // y轴类型为数值轴
		              },
		              series: [{
		                type: 'line', // 图表类型为折线图
		                data: [120, 180, 150, 80, 70, 110, 130] // 折线图数据
		              }]
		            }
		            this.chart.setOption(option)
		      }
		  }
	}
</script>

<style lang="scss">

</style>